package com.hevery.blog.model;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.Min;

/**
 * @description: ${description}
 * @author: hongyu.zhang
 * @create: 2018-04-03
 **/
@Getter
@Setter
@ToString
public class TestVO {
    @Min(value = 10,message = "id大小在{min}和{max}之间")
    private Integer id;
    @NotBlank(message = "name不能为空")
    private String name;
    @NotBlank(message = "password must not be blank")
    @Length(min = 6,max = 16,message = "password length between {min} and {max}")
    private String password;
    @NotBlank(message = "password must not be blank")
    @Length(min = 6,max = 16,message = "password length between {min} and {max}")
    private String confirmPassword;

    @AssertTrue(message = "confirmPassword and password must be equals")
    public boolean isEuqalsPassword(){
        return confirmPassword != null  && password.equals(confirmPassword);
    }
}
